#ifndef LIGHTSHADER_H
#define LIGHTSHADER_H

#include <d3d10.h>
#include <d3dx10math.h>
#include <fstream>

#include "Texture.h"
#include "Matrix4x4.h"
#include "Colour.h"

class LightShader
{
public:
	LightShader();
	LightShader(const LightShader& other);
	~LightShader();

	bool Initialize();
	void Shutdown();
	void Render(int indexCount, Matrix4x4 worldMatrix, Matrix4x4 viewMatrix, Matrix4x4 projectionMatrix, Texture* texture, Vec3 lightDirection, Colour diffuseColor);

private:
	bool InitializeShader(const std::string& filename);
	void ShutdownShader();
	void OutputShaderErrorMessage(ID3D10Blob* errorMessage, const std::string& shaderFilename);

	void SetShaderParameters(Matrix4x4 worldMatrix, Matrix4x4 viewMatrix, Matrix4x4 projectionMatrix, Texture* texture, Vec3 lightDirection, Colour diffuseColor);
	void RenderShader(int indexCount);

private:

	ID3D10Effect* m_Effect;
	ID3D10EffectTechnique* m_Technique;
	ID3D10InputLayout* m_Layout;

	ID3D10EffectMatrixVariable* m_WorldMatrix;
	ID3D10EffectMatrixVariable* m_ViewMatrix;
	ID3D10EffectMatrixVariable* m_ProjectionMatrix;

	//variable for the shader texture resource pointer
	ID3D10EffectShaderResourceVariable* m_Texture;

	//direction of the light and the 
	ID3D10EffectVectorVariable* m_LightDirection;
	//diffuse color of the light
	ID3D10EffectVectorVariable* m_DiffuseColor;
};

#endif
